package com.chrray.position.pojo.dto.web;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chrray.position.domain.FdFeedback;
import com.chrray.position.domain.FdJobPostings;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Transient;
import java.time.LocalDateTime;

/**
 * @author LM
 * @date 2024/9/2 10:18
 */
@Data
public class FdFeedBackExe<T> extends FdFeedback {

    @TableField(exist = false)
    @JsonIgnore
    @Transient
    private int pageNum = 1;

    /***
     * 页面数量
     */
    @TableField(exist = false)
    @JsonIgnore
    @Transient
    private int pageSize = 10;

    @DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "开始时间", example = "2018-10-10 20:20:20")
    @Transient
    @TableField(exist = false)
    private LocalDateTime startTime;
    @DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "结束时间", example = "2020-10-10 20:20:20")
    @Transient
    @TableField(exist = false)
    private LocalDateTime endTime;

    @JsonIgnore
    public IPage<T> getPage() {
        Page<T> objectPage = new Page<>();
        objectPage.setCurrent(pageNum);
        objectPage.setSize(pageSize);
        return objectPage;
    }
}
